﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:SQLServerCompanion;assembly="
                    xmlns:ctl="clr-namespace:SQLServerCompanion.Controls;assembly="
                    >

    <local:BoolToVisibilityConverter x:Key="boolToVisConv"/>

    <Style x:Key="LoadingStyle" TargetType="{x:Type FrameworkElement}">
        <Setter Property="Visibility" Value="Collapsed" />
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsLoading}" Value="True">
                <Setter Property="Visibility" Value="Visible"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <SolidColorBrush x:Key="TabControlNormalBorderBrush" Color="#8C8E94"/>

    <SolidColorBrush x:Key="TabBorderBrush" Color="#FF00CE29"/>

    <RadialGradientBrush x:Key="selectedGradientGlow">
        <GradientStop Color="LightGray" Offset="0"/>
        <GradientStop Color="#0059FF6B" Offset="1"/>
    </RadialGradientBrush>

    <!--<SolidColorBrush  x:Key="selectedBrush" Color="LightBlue"/>-->
    <!-- Tab selected brush -->

    <LinearGradientBrush x:Key="selectedBrush" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF8E8C5E"/>
        <GradientStop Color="White" Offset="1"/>
    </LinearGradientBrush>

    <SolidColorBrush  x:Key="nonSelectedBrush" Color="#bF00CE29"/>


    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"  x:Key="horizontalTabHeaderBackground" Opacity="0.2">
        <GradientStop Color="#FF000000" Offset="0.033"/>
        <GradientStop Color="#FFEBEBEB" Offset="0.16"/>
        <GradientStop Color="#FFE4DCDC" Offset="0.003"/>
        <GradientStop Color="#FFFFFFFF" Offset="0.253"/>
        <GradientStop Color="#FFFFFFFF" Offset="1"/>
        <GradientStop Color="#FFD6D0D0" Offset="0.945"/>
        <GradientStop Color="#FFFFFFFF" Offset="0.852"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="mainGridBrush"  EndPoint="1.224,0.5" StartPoint="-0.09,0.496">
        <GradientStop Color="Gray" Offset="0"/>
        <GradientStop Color="#ffEAEAEA" Offset="0.1"/>
        <GradientStop Color="LightGray" Offset="0.089"/>
    </LinearGradientBrush>


    <Style x:Key="ContextMenuItemStyle">
        <Setter Property="MenuItem.Header" Value="{Binding Text}"/>
        <Setter Property="MenuItem.Command" Value="{Binding Command}" />
        <Setter Property="MenuItem.CommandParameter" Value="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor,ListView,1}}"/>
    </Style>

    <ControlTemplate x:Key="GlassButton" TargetType="{x:Type Button}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="Timeline1">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="Timeline2">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>
        <Border BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4" 
		    HorizontalAlignment="Stretch">
            <Border x:Name="border" Background="#7F000000" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.507*"/>
                        <RowDefinition Height="0.493*"/>
                    </Grid.RowDefinitions>
                    <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4">
                        <Border.Background>
                            <RadialGradientBrush>
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1.702" ScaleY="2.243"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="0"/>
                                        <TranslateTransform X="-0.368" Y="-0.152"/>
                                    </TransformGroup>
                                </RadialGradientBrush.RelativeTransform>
                                <GradientStop Color="#B28DBDFF" Offset="0"/>
                                <GradientStop Color="#008DBDFF" Offset="1"/>
                            </RadialGradientBrush>
                        </Border.Background>
                    </Border>
                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2"/>
                    <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="shine" Width="Auto" CornerRadius="4,4,0,0">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.494,0.889" StartPoint="0.494,0.028">
                                <GradientStop Color="#99FFFFFF" Offset="0"/>
                                <GradientStop Color="#33FFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Grid>
            </Border>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Opacity" TargetName="shine" Value="0.4"/>
                <Setter Property="Background" TargetName="border" Value="#CC000000"/>
                <Setter Property="Visibility" TargetName="glow" Value="Hidden"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource Timeline1}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                    <BeginStoryboard x:Name="Timeline2_BeginStoryboard" Storyboard="{StaticResource Timeline2}"/>
                </Trigger.ExitActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>


    <!-- TextBoxes-->
    <Style x:Key="ValidatingTextBox" TargetType="{x:Type TextBoxBase}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Border 
                          Name="Border"
                          CornerRadius="5" 
                          Padding="2"
                          Background="White"
                          BorderBrush="Black"
                          BorderThickness="2" >
                        <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="LightGray"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="Black"/>
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" 
                                    Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                            Path=(Validation.Errors).CurrentItem.ErrorContent}"/>
            </Trigger>
        </Style.Triggers>
    </Style>


    <!-- TextBox control-->


    <Style x:Key="NormalButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Foreground" Value="#FFFFFF" />
        <Setter Property="Width" Value="100" />
        <Setter Property="Height" Value="30" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Padding" Value="5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Rectangle x:Name="Rectangle" Stroke="#FF051F42" StrokeMiterLimit="1.000000" StrokeThickness="0.500000" RadiusX="5" RadiusY="5">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.501,0.039" StartPoint="0.501,0.971">
                                    <GradientStop Color="#FF1F317D" Offset="0.101" />
                                    <GradientStop Color="#FF1F317D" Offset="0.49" />
                                    <GradientStop Color="#FF6C8EBD" Offset="0.51" />
                                    <GradientStop Color="#FF283D8C" Offset="0" />
                                    <GradientStop Color="#FF7094C7" Offset="0.986" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused" Value="true" />
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="Rectangle">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.501,0.039" StartPoint="0.501,0.971">
                                        <GradientStop Color="#FF2C558C" Offset="0.101" />
                                        <GradientStop Color="#FF1F317D" Offset="0.49" />
                                        <GradientStop Color="#FF9DB5D7" Offset="0.51" />
                                        <GradientStop Color="#FF244AAF" Offset="0" />
                                        <GradientStop Color="#FF87A4D9" Offset="0.986" />
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="BlackButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource NormalButtonStyle}">
        <Setter Property="Width" Value="100" />
        <Setter Property="Height" Value="30" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Margin="5">
                        <Rectangle Stroke="#FF000000" StrokeMiterLimit="1.000000" StrokeThickness="0.500000" RadiusX="5" RadiusY="5" x:Name="rectangle">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.501,0.039" StartPoint="0.501,0.971">
                                    <GradientStop Color="#FF1E1E1E" Offset="0.101" />
                                    <GradientStop Color="#FF1E1E1E" Offset="0.49" />
                                    <GradientStop Color="#FF5B5959" Offset="0.51" />
                                    <GradientStop Color="#FF2F2F2F" Offset="0" />
                                    <GradientStop Color="#FF5B5959" Offset="0.986" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused" Value="true" />
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="rectangle">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.501,0.039" StartPoint="0.501,0.971">
                                        <GradientStop Color="#FF3A3A3A" Offset="0.101" />
                                        <GradientStop Color="#FF1E1E1E" Offset="0.49" />
                                        <GradientStop Color="#FFB0B0B0" Offset="0.51" />
                                        <GradientStop Color="#FF656565" Offset="0" />
                                        <GradientStop Color="#FF989898" Offset="0.938" />
                                        <GradientStop Color="#FF7F7F7F" Offset="0.986" />
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Button control -->
    <Style TargetType="{x:Type Button}" BasedOn="{StaticResource NormalButtonStyle}">
        <Setter Property="MinWidth" Value="100"/>
        <Setter Property="MinHeight" Value="25"/>
        <Setter Property="Margin" Value="5"/>
        <Setter Property="Padding" Value="5"/>
        <!--<Setter Property="Template" Value="{StaticResource GlassButton}"/>-->
    </Style>

    <!-- Main grid style  -->
    <Style x:Key="MainGridBorder" TargetType="{x:Type Border}">
        <Setter Property="Background" Value="White" />
        <Setter Property="BorderBrush" Value="Black" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="CornerRadius" Value="5" />
        <Setter Property="Background" >
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF000000" Offset="0.033"/>
                    <GradientStop Color="#FFEBEBEB" Offset="0.16"/>
                    <GradientStop Color="#FFE4DCDC" Offset="0.003"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0.253"/>
                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                    <GradientStop Color="#FFD6D0D0" Offset="0.945"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0.852"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BitmapEffect">
            <Setter.Value>
                <OuterGlowBitmapEffect GlowSize="6" GlowColor="Gray" Opacity="1"/>
            </Setter.Value>
        </Setter>
    </Style>


    <!--Gridview styling -->
    <Style x:Key="MyColumnHeaderContainerStyle" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF8E8C5E"/>
                    <GradientStop Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="Black"/>

        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0"/>
                    <GradientStop Color="Gray" Offset="1.0"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <!--Listview styling -->
    <Style x:Key="MyListViewHeaderContainerStyle" TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF8E8C5E"/>
                    <GradientStop Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="Black"/>

        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0"/>
                    <GradientStop Color="Gray" Offset="1.0"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>